{
 "cells": [
  {
   "cell_type": "code",
   "execution_count": 1,
   "metadata": {},
   "outputs": [],
   "source": [
    "import pandas as pd\n",
    "import pickle\n",
    "import numpy as np\n",
    "import datetime\n",
    "import collections"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 2,
   "metadata": {},
   "outputs": [],
   "source": [
    "def get_dfs(files, file_type):\n",
    "    \n",
    "        if(file_type == \"csv\"):\n",
    "            return (pd.read_csv(file) for file in files)\n",
    "\n",
    "\n",
    "        elif(file_type == \"excel\"):\n",
    "            return (pd.read_excel(file) for file in files)\n",
    "            \n",
    "            \n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 3,
   "metadata": {},
   "outputs": [],
   "source": [
    "# One hot encoding\n",
    "def get_dummies(data, test_data, cols):\n",
    "    \n",
    "    data[\"train\"] = 1\n",
    "    test_data[\"train\"] = 0\n",
    "    \n",
    "    merged_data = pd.concat([data, test_data], axis = 0).reset_index(drop=True)\n",
    "    \n",
    "    \n",
    "    for col in cols:\n",
    "        \n",
    "        merged_data = pd.concat([pd.get_dummies(merged_data[col] , prefix=col, dummy_na=True) , merged_data],axis = 1)\n",
    "        \n",
    "    return merged_data\n",
    "    "
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 4,
   "metadata": {},
   "outputs": [],
   "source": [
    "def split_month(x):\n",
    "    return x.split('-')[1]\n",
    "\n",
    "def split_year(x):\n",
    "    return x.split('-')[2]"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 5,
   "metadata": {},
   "outputs": [],
   "source": [
    "def is_reinspection(x):\n",
    "    if (x.find('RE-INSPECTION') == -1): \n",
    "        return 0\n",
    "    else:\n",
    "        return 1"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 6,
   "metadata": {},
   "outputs": [],
   "source": [
    "def convert_date(d):\n",
    "    try:\n",
    "        \n",
    "        return datetime.datetime.strptime(d, '%d-%m-%Y')\n",
    "    except Exception as e:\n",
    "        converted_str = str(int(d.split(\"-\")[0]) - 1)  + '-' + str(d.split(\"-\")[1]) +  '-' + str(d.split(\"-\")[2])\n",
    "        \n",
    "        return  datetime.datetime.strptime(converted_str, '%d-%m-%Y')"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 7,
   "metadata": {},
   "outputs": [],
   "source": [
    "def save_model(filename):\n",
    "    pickle.dump(model, open(filename, 'wb'))"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": []
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": []
  },
  {
   "cell_type": "code",
   "execution_count": 8,
   "metadata": {},
   "outputs": [],
   "source": [
    "data, test_data, sample_sub, final_type = get_dfs([\"Food_QUalityA_ParticipantsData/Data_Train.xlsx\",\\\n",
    "                                      \"Food_QUalityA_ParticipantsData/Data_Test.xlsx\",\\\n",
    "                                      \"Food_QUalityA_ParticipantsData/Sample_Submission.xlsx\", \"type_df_org.xlsx\"], file_type = \"excel\")"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 9,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>ID</th>\n",
       "      <th>Date</th>\n",
       "      <th>LicenseNo</th>\n",
       "      <th>FacilityID</th>\n",
       "      <th>FacilityName</th>\n",
       "      <th>Type</th>\n",
       "      <th>Street</th>\n",
       "      <th>City</th>\n",
       "      <th>State</th>\n",
       "      <th>LocationID</th>\n",
       "      <th>Reason</th>\n",
       "      <th>SectionViolations</th>\n",
       "      <th>RiskLevel</th>\n",
       "      <th>Geo_Loc</th>\n",
       "      <th>Inspection_Results</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <td>0</td>\n",
       "      <td>31103489027986</td>\n",
       "      <td>26-04-2010</td>\n",
       "      <td>4744</td>\n",
       "      <td>8123</td>\n",
       "      <td>7715</td>\n",
       "      <td>RESTAURANT</td>\n",
       "      <td>15522</td>\n",
       "      <td>id-11235901</td>\n",
       "      <td>id_1890134</td>\n",
       "      <td>81876.0</td>\n",
       "      <td>CANVASS</td>\n",
       "      <td>33.0</td>\n",
       "      <td>High</td>\n",
       "      <td>locid16406</td>\n",
       "      <td>4</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <td>1</td>\n",
       "      <td>10088999935915</td>\n",
       "      <td>21-06-2009</td>\n",
       "      <td>2973</td>\n",
       "      <td>12268</td>\n",
       "      <td>11664</td>\n",
       "      <td>GROCERY STORE</td>\n",
       "      <td>3057</td>\n",
       "      <td>id-11235901</td>\n",
       "      <td>id_1890134</td>\n",
       "      <td>81862.0</td>\n",
       "      <td>COMPLAINT</td>\n",
       "      <td>33.0</td>\n",
       "      <td>High</td>\n",
       "      <td>locid878</td>\n",
       "      <td>4</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <td>2</td>\n",
       "      <td>40148966010272</td>\n",
       "      <td>01-05-2013</td>\n",
       "      <td>18223</td>\n",
       "      <td>1112</td>\n",
       "      <td>969</td>\n",
       "      <td>RESTAURANT</td>\n",
       "      <td>14988</td>\n",
       "      <td>id-11235901</td>\n",
       "      <td>id_1890134</td>\n",
       "      <td>81883.0</td>\n",
       "      <td>CANVASS</td>\n",
       "      <td>NaN</td>\n",
       "      <td>High</td>\n",
       "      <td>locid3368</td>\n",
       "      <td>6</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <td>3</td>\n",
       "      <td>37157708563676</td>\n",
       "      <td>28-09-2015</td>\n",
       "      <td>20825</td>\n",
       "      <td>20007</td>\n",
       "      <td>19115</td>\n",
       "      <td>RESTAURANT</td>\n",
       "      <td>3661</td>\n",
       "      <td>id-11235901</td>\n",
       "      <td>id_1890134</td>\n",
       "      <td>81859.0</td>\n",
       "      <td>CANVASS RE-INSPECTION</td>\n",
       "      <td>31.0</td>\n",
       "      <td>Medium</td>\n",
       "      <td>locid11839</td>\n",
       "      <td>4</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <td>4</td>\n",
       "      <td>47478049564374</td>\n",
       "      <td>09-12-2015</td>\n",
       "      <td>2136</td>\n",
       "      <td>16867</td>\n",
       "      <td>10409</td>\n",
       "      <td>RESTAURANT</td>\n",
       "      <td>7876</td>\n",
       "      <td>id-11235901</td>\n",
       "      <td>id_1890134</td>\n",
       "      <td>81886.0</td>\n",
       "      <td>COMPLAINT</td>\n",
       "      <td>30.0</td>\n",
       "      <td>High</td>\n",
       "      <td>locid12264</td>\n",
       "      <td>4</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "               ID        Date  LicenseNo  FacilityID  FacilityName  \\\n",
       "0  31103489027986  26-04-2010       4744        8123          7715   \n",
       "1  10088999935915  21-06-2009       2973       12268         11664   \n",
       "2  40148966010272  01-05-2013      18223        1112           969   \n",
       "3  37157708563676  28-09-2015      20825       20007         19115   \n",
       "4  47478049564374  09-12-2015       2136       16867         10409   \n",
       "\n",
       "            Type  Street         City       State  LocationID  \\\n",
       "0     RESTAURANT   15522  id-11235901  id_1890134     81876.0   \n",
       "1  GROCERY STORE    3057  id-11235901  id_1890134     81862.0   \n",
       "2     RESTAURANT   14988  id-11235901  id_1890134     81883.0   \n",
       "3     RESTAURANT    3661  id-11235901  id_1890134     81859.0   \n",
       "4     RESTAURANT    7876  id-11235901  id_1890134     81886.0   \n",
       "\n",
       "                  Reason  SectionViolations RiskLevel     Geo_Loc  \\\n",
       "0                CANVASS               33.0      High  locid16406   \n",
       "1              COMPLAINT               33.0      High    locid878   \n",
       "2                CANVASS                NaN      High   locid3368   \n",
       "3  CANVASS RE-INSPECTION               31.0    Medium  locid11839   \n",
       "4              COMPLAINT               30.0      High  locid12264   \n",
       "\n",
       "   Inspection_Results  \n",
       "0                   4  \n",
       "1                   4  \n",
       "2                   6  \n",
       "3                   4  \n",
       "4                   4  "
      ]
     },
     "execution_count": 9,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "data.head()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 10,
   "metadata": {},
   "outputs": [],
   "source": [
    "data['month'] =  data['Date'].apply(split_month)\n",
    "test_data['month'] =  test_data['Date'].apply(split_month)\n",
    "\n",
    "data['year'] =  data['Date'].apply(split_year)\n",
    "test_data['year'] =  test_data['Date'].apply(split_year)\n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 11,
   "metadata": {},
   "outputs": [],
   "source": [
    "final_map_index = final_type.set_index(0).T.to_dict('list')"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 12,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "{'RESTAURANT': [0, 'RESTAURANT', nan],\n",
       " 'GROCERY STORE': [1, 'GROCERY', nan],\n",
       " \"CHILDREN'S SERVICES FACILITY\": [2, \"CHILDREN'S SERVICES FACILITY\", nan],\n",
       " 'GAS STATION': [3, 'GAS', nan],\n",
       " 'SCHOOL': [4, 'SCHOOL', nan],\n",
       " 'PALETERIA': [5, 'PALETERIA', nan],\n",
       " 'DAYCARE ABOVE AND UNDER 2 YEARS': [6, 'DAYCARE', nan],\n",
       " 'MEAT PACKING': [7, 'MEAT PACKING', nan],\n",
       " 'LONG TERM CARE': [8, 'LONG TERM CARE ', nan],\n",
       " nan: [9, nan, nan],\n",
       " 'LIQUOR': [10, 'LIQUOR', nan],\n",
       " 'DAYCARE (2 - 6 YEARS)': [11, 'DAYCARE', nan],\n",
       " 'COMMISSARY FOR SOFT SERVE ICE CREAM TRUCKS': [12, 'COMMISSARY', nan],\n",
       " 'CONVENIENCE STORE': [13, 'CONVENIENCE', nan],\n",
       " 'DAYCARE (UNDER 2 YEARS)': [14, 'DAYCARE', nan],\n",
       " 'SHARED KITCHEN USER (LONG TERM)': [15, 'SHARED KITCHEN', nan],\n",
       " 'GOLDEN DINER': [16, 'RESTAURANT', nan],\n",
       " 'BAKERY': [17, 'BAKERY', nan],\n",
       " 'WRIGLEY ROOFTOP': [18, 'ROOFTOP', nan],\n",
       " 'DAYCARE COMBO 1586': [19, 'DAYCARE', nan],\n",
       " 'DAYCARE NIGHT': [20, 'DAYCARE', nan],\n",
       " 'MOBILE FOOD PREPARER': [21, 'MOBILE FOOD', nan],\n",
       " 'POPCORN SHOP': [22, 'POPCORN', nan],\n",
       " 'TAVERN': [23, 'TAVERN', nan],\n",
       " 'HOSPITAL': [24, 'HOSPITAL', nan],\n",
       " 'CATERING': [25, 'CATERING', nan],\n",
       " 'PRIVATE SCHOOL': [26, 'SCHOOL', nan],\n",
       " 'SHELTER': [27, 'SHELTER', nan],\n",
       " 'TAVERN GRILL': [28, 'TAVERN', nan],\n",
       " 'MOBILE FOOD DISPENSER': [29, 'MOBILE FOOD', nan],\n",
       " 'MOBILE DESSERTS VENDOR': [30, 'MOBILE FOOD', nan],\n",
       " 'WHOLESALE': [31, 'WHOLESALE', nan],\n",
       " 'SPECIAL EVENT': [32, 'SPECIAL EVENT', nan],\n",
       " 'GAS STATION/RESTAURANT': [33, 'GAS/RESTAURANT', nan],\n",
       " 'SENIOR DAY CARE': [34, 'DAYCARE', nan],\n",
       " 'DAYCARE': [35, 'DAYCARE', nan],\n",
       " 'BANQUET': [36, 'BANQUET', nan],\n",
       " 'BANQUET HALL': [37, 'BANQUET', nan],\n",
       " 'ROOFTOPS': [38, 'ROOFTOP', nan],\n",
       " 'SHARED KITCHEN': [39, 'SHARED KITCHEN', nan],\n",
       " 'LIVE POULTRY': [40, 'POULTRY', nan],\n",
       " 'BAR/GRILL': [41, 'BAR/GRILL', nan],\n",
       " 'DAYCARE 2 YRS TO 12 YRS': [42, 'DAYCARE', nan],\n",
       " 'RESTAURANT(PROTEIN SHAKE BAR)': [43, 'RESTAURANT', nan],\n",
       " 'COFFEE SHOP': [44, 'COFFEE', nan],\n",
       " 'MOBILE PREPARED FOOD VENDOR': [45, 'MOBILE FOOD', nan],\n",
       " \"1023 CHILDERN'S SERVICE FACILITY\": [46, \"CHILDREN'S SERVICES FACILITY\", nan],\n",
       " 'KIOSK': [47, 'KIOSK', nan],\n",
       " 'SHARED KITCHEN USER (SHORT TERM)': [48, 'SHARED KITCHEN', nan],\n",
       " 'THEATER': [49, 'THEATER', nan],\n",
       " 'CAFETERIA': [50, 'CAFETERIA', nan],\n",
       " 'BREWPUB': [51, 'BAR', nan],\n",
       " 'NURSING HOME': [52, 'NURSING HOME', nan],\n",
       " 'CHURCH': [53, 'SPECIAL EVENT', nan],\n",
       " 'GAS STATION /GROCERY': [54, 'GAS/GROCERY', nan],\n",
       " 'COOKING SCHOOL': [55, 'COOKING SCHOOL', nan],\n",
       " 'WRIGLEY ROOF TOP': [56, 'ROOFTOP', nan],\n",
       " '1023': [57, \"CHILDREN'S SERVICES FACILITY\", nan],\n",
       " 'CHARTER SCHOOL': [58, 'CHARTER SCHOOL', nan],\n",
       " 'SHARED KITCHEN USER (LONG TREM)': [59, 'SHARED KITCHEN', nan],\n",
       " 'SHUFFLEBOARD CLUB WITH BAR': [60, 'CLUB ', nan],\n",
       " 'ICE CREAM PARLOR': [61, 'ICE CREAM', nan],\n",
       " 'SUMMER FEEDING': [62, 'SUMMER FEEDING', nan],\n",
       " \"CHILDERN'S SERVICE FACILITY\": [63, \"CHILDREN'S SERVICES FACILITY\", nan],\n",
       " 'RESTAURANT/BAKERY': [64, 'BAKERY/RESTAURANT', nan],\n",
       " \"1023 CHILDERN'S SERVICES FACILITY\": [65,\n",
       "  \"CHILDREN'S SERVICES FACILITY\",\n",
       "  nan],\n",
       " \"1023-CHILDREN'S SERVICES FACILITY\": [66,\n",
       "  \"CHILDREN'S SERVICES FACILITY\",\n",
       "  nan],\n",
       " 'MOBILE FROZEN DESSERTS VENDOR': [67, 'MOBILE FOOD', nan],\n",
       " 'MOVIE THEATER': [68, 'THEATER', nan],\n",
       " 'GROCERY/GAS STATION': [69, 'GAS/GROCERY', nan],\n",
       " 'CONVENIENCE': [70, 'CONVENIENCE', nan],\n",
       " 'ROOFTOP': [71, 'ROOFTOP', nan],\n",
       " \"1023 CHILDERN'S SERVICE S FACILITY\": [72,\n",
       "  \"CHILDREN'S SERVICES FACILITY\",\n",
       "  nan],\n",
       " 'RESTAURANT/GROCERY STORE': [73, 'GROCERY/RESTAURANT', nan],\n",
       " 'POULTRY SLAUGHTER': [74, 'POULTRY', nan],\n",
       " 'RESTAURANT/BAR': [75, 'BAR/RESTAURANT', nan],\n",
       " 'NAVY PIER KIOSK': [76, 'KIOSK', nan],\n",
       " 'STADIUM': [77, 'STADIUM', nan],\n",
       " 'GROCERY& RESTAURANT': [78, 'GROCERY/RESTAURANT', nan],\n",
       " 'GROCERY/RESTAURANT': [79, 'GROCERY/RESTAURANT', nan],\n",
       " 'BEFORE AND AFTER SCHOOL PROGRAM': [80, 'SCHOOL', nan],\n",
       " 'FITNESS CENTER': [81, 'GYM', nan],\n",
       " 'ROOF TOPS': [82, 'ROOFTOP', nan],\n",
       " 'UNIVERSITY CAFETERIA': [83, 'CAFETERIA', nan],\n",
       " 'PREP INSIDE SCHOOL': [84, 'SCHOOL', nan],\n",
       " 'PUSHCART': [85, 'PUSHCART', nan],\n",
       " 'A-NOT-FOR-PROFIT CHEF TRAINING PROGRAM': [86, 'NGO', nan],\n",
       " 'MOBILE FOOD TRUCK': [87, 'MOBILE FOOD', nan],\n",
       " 'GROCERY(SUSHI PREP)': [88, 'GROCERY', nan],\n",
       " 'ASSISTED LIVING': [89, 'ASSISTEDLIVING', nan],\n",
       " 'LIQUORE STORE/BAR': [90, 'LIQUOR', nan],\n",
       " 'CULINARY SCHOOL': [91, 'SCHOOL', nan],\n",
       " 'CONVENIENT STORE': [92, 'CONVENIENCE', nan],\n",
       " 'GROCERY STORE/BAKERY': [93, 'BAKERY/GROCERY', nan],\n",
       " 'MOVIE THEATRE': [94, 'THEATER', nan],\n",
       " 'GROCERY & RESTAURANT': [95, 'GROCERY/RESTAURANT', nan],\n",
       " 'HOT DOG STATION': [96, 'HOTDOG', nan],\n",
       " 'DAY CARE 2-14': [97, 'DAYCARE', nan],\n",
       " 'ROOF TOP': [98, 'ROOFTOP', nan],\n",
       " 'JUICE AND SALAD BAR': [99, 'JUICE', nan],\n",
       " 'NOT-FOR-PROFIT CLUB': [100, 'NGO', nan],\n",
       " 'GROCERY/ RESTAURANT': [101, 'GROCERY/RESTAURANT', nan],\n",
       " 'HERBAL MEDICINE': [102, 'MEDICINE', nan],\n",
       " 'NORTHERLY ISLAND': [103, 'NORTHERLY ISLAND', nan],\n",
       " 'BAKERY/DELI': [104, 'BAKERY/DELI', nan],\n",
       " 'CANDY STORE': [105, 'CANDY', nan],\n",
       " 'POP-UP ESTABLISHMENT HOST-TIER II': [106, 'POP-UP', nan],\n",
       " 'GROCERY AND BUTCHER': [107, 'BUTCHER/GROCERY', nan],\n",
       " 'HOOKA LOUNGE': [108, 'LOUNGE', nan],\n",
       " 'GROCERY STORE/GAS STATION': [109, 'GAS/GROCERY', nan],\n",
       " 'RESTAURANT.BANQUET HALLS': [110, 'BANQUET/RESTAURANT', nan],\n",
       " 'HEALTH/ JUICE BAR': [111, 'JUICE', nan],\n",
       " 'GROCERY/SERVICE GAS STATION': [112, 'GAS/GROCERY', nan],\n",
       " 'TRUCK': [113, 'TRUCK', nan],\n",
       " 'WEIGHT LOSS PROGRAM': [114, 'GYM', nan],\n",
       " 'MUSIC VENUE': [115, 'MUSIC', nan],\n",
       " 'COFFEE  SHOP': [116, 'COFFEE', nan],\n",
       " 'REST/GROCERY': [117, 'GROCERY', nan],\n",
       " 'SUSHI COUNTER': [118, 'COUNTER', nan],\n",
       " 'CELL PHONE STORE': [119, 'CELL PHONE STORE', nan],\n",
       " 'BAR': [120, 'BAR', nan],\n",
       " 'CANDY/GELATO': [121, 'CANDY/GELATO', nan],\n",
       " 'SOCIAL CLUB': [122, 'CLUB', nan],\n",
       " 'MOBILE FOOD': [123, 'MOBILE FOOD', nan],\n",
       " 'DAYCARE (2 YEARS)': [124, 'DAYCARE', nan],\n",
       " 'HOTEL': [125, 'RESTAURANT', nan],\n",
       " 'PUBLIC SHCOOL': [126, 'SCHOOL', nan],\n",
       " 'RIVERWALK CAFE': [127, 'CAFETERIA', nan],\n",
       " 'BANQUET ROOMS': [128, 'BANQUET', nan],\n",
       " 'HERBALIFE': [129, 'HERBALIFE', nan],\n",
       " 'NOT FOR PROFIT': [130, 'NGO', nan],\n",
       " 'LONG-TERM CARE FACILITY': [131, 'LONG TERM CARE ', nan],\n",
       " 'WAREHOUSE': [132, 'WAREHOUSE', nan],\n",
       " 'COLLEGE': [133, 'COLLEGE', nan],\n",
       " 'THEATER & RESTAURANT': [134, 'RESTAURANT/THEATER', nan],\n",
       " 'DOLLAR STORE': [135, 'DOLLAR', nan],\n",
       " 'SUPPORTIVE LIVING': [136, 'SUPPORTIVE LIVING', nan],\n",
       " 'GAS': [137, 'GAS', nan],\n",
       " 'REST/GYM': [138, 'GYM', nan],\n",
       " 'DRUG STORE': [139, 'DRUG', nan],\n",
       " 'ROOM SERVICE': [140, 'ROOM SERVICE', nan],\n",
       " 'ART GALLERY W/WINE AND BEER': [141, 'ART GALLERY/BAR', nan],\n",
       " 'CHILDRENS SERVICES FACILITY': [142, \"CHILDREN'S SERVICES FACILITY\", nan],\n",
       " 'CHARTER SCHOOL/CAFETERIA': [143, 'CHARTER SCHOOL', 'CAFETERIA'],\n",
       " 'ICE CREAM SHOP': [144, 'ICE CREAM', nan],\n",
       " 'CHINESE HERBS': [145, 'HERBALIFE', nan],\n",
       " 'RIVERWALK': [146, 'RIVERWALK', nan],\n",
       " 'BANQUET DINING': [147, 'BANQUET', nan],\n",
       " 'NUTRITION/HERBALIFE': [148, 'HERBALIFE', 'NUTRITION'],\n",
       " 'GOLF COURSE': [149, 'GOLF', nan],\n",
       " 'CULINARY ARTS SCHOOL': [150, 'SCHOOL', nan],\n",
       " 'EMPLOYEE KITCHEN': [151, 'KITCHEN', nan],\n",
       " 'CHURCH KITCHEN': [152, 'KITCHEN', nan],\n",
       " 'PRE PACKAGED': [153, 'PACKAGE', nan],\n",
       " '1475 LIQUOR': [154, 'LIQUOR', nan],\n",
       " 'OTHER': [155, 'OTHER', nan],\n",
       " 'COMMISSARY': [156, 'COMMISSARY', nan],\n",
       " 'BANQUET/KITCHEN': [157, 'BANQUET', 'KITCHEN'],\n",
       " 'REGULATED BUSINESS': [158, 'REGULATED BUSINESS', nan],\n",
       " 'DAYCARE 2-6, UNDER 6': [159, 'DAYCARE', nan],\n",
       " 'MOBILE FROZEN DESSERT VENDOR': [160, 'MOBILE FOOD', nan],\n",
       " 'LINITED BUSINESS': [161, 'LINITED BUSINESS', nan],\n",
       " 'EVENT SPACE': [162, 'SPECIAL EVENT', nan],\n",
       " 'LOUNGE/BANQUET HALL': [163, 'BANQUET', 'LOUNGE'],\n",
       " 'GAS STATION/STORE': [164, 'GAS', 'STORE'],\n",
       " 'LIQUOR CONSUMPTION ON PREMISES.': [165, 'LIQUOR', nan],\n",
       " 'LIQOUR BREWERY TASTING': [166, 'LIQUOR', nan],\n",
       " '1005 NURSING HOME': [167, 'NURSING HOME', nan],\n",
       " 'DAYCARE COMBO': [168, 'DAYCARE', nan],\n",
       " \"CHILDERN'S SERVICES  FACILITY\": [169, \"CHILDREN'S SERVICES FACILITY\", nan],\n",
       " 'COFFEE CART': [170, 'COFFEE', nan],\n",
       " 'LONG TERM CARE FACILITY': [171, 'LONG TERM CARE ', nan],\n",
       " 'BANQUET FACILITY': [172, 'BANQUET', nan],\n",
       " 'DAY CARE 1023': [173, 'DAYCARE', nan],\n",
       " 'BOOK STORE': [174, 'STORE', nan],\n",
       " 'FOOD BOOTH': [175, 'FOOD BOOTH', nan],\n",
       " 'GAS STATION/MINI MART': [176, 'GAS', 'MART'],\n",
       " 'GROCERY/TAVERN': [177, 'GROCERY', 'TAVERN'],\n",
       " 'ASSISTED LIVING SENIOR CARE': [178, 'ASSISTEDLIVING', nan],\n",
       " 'STORE': [179, 'STORE', nan],\n",
       " 'ALTERNATIVE SCHOOL': [180, 'SCHOOL', nan],\n",
       " 'DOLLAR TREE': [181, 'DOLLAR', nan],\n",
       " 'TEA BREWING': [182, 'TEA', nan],\n",
       " 'GROCERY/CAFE': [183, 'CAFETERIA', 'GROCERY'],\n",
       " 'HOSTEL': [184, 'HOSTEL', nan],\n",
       " 'CITY OF CHICAGO COLLEGE': [185, 'COLLEGE', nan],\n",
       " 'MFD TRUCK': [186, 'TRUCK', nan],\n",
       " 'GYM STORE': [187, 'GYM', nan],\n",
       " 'HOT DOG CART': [188, 'HOTDOG', nan],\n",
       " 'RESTAURANT/HOSPITAL': [189, 'HOSPITAL', 'RESTAURANT'],\n",
       " 'RESTUARANT AND BAR': [190, 'BAR', 'RESTAURANT'],\n",
       " 'SCHOOL CAFETERIA': [191, 'CAFETERIA', nan],\n",
       " \"O'HARE KIOSK\": [192, 'KIOSK', nan],\n",
       " 'AIRPORT LOUNGE': [193, 'LOUNGE', nan],\n",
       " 'GROCERY STORE/COOKING SCHOOL': [194, 'COOKING SCHOOL', 'GROCERY'],\n",
       " 'CHURCH (SPECIAL EVENTS)': [195, 'SPECIAL EVENT', nan],\n",
       " 'WINE STORE': [196, 'LIQUOR', nan],\n",
       " 'RESTAURANT/GAS STATION': [197, 'GAS', 'RESTAURANT'],\n",
       " 'BANQUET HALL/CATERING': [198, 'BANQUET', 'CATERING'],\n",
       " 'CHARITY AID KITCHEN': [199, 'CHARITY', nan],\n",
       " 'BUTCHER SHOP': [200, 'BUTCHER', nan],\n",
       " 'FOOD VENDING MACHINES': [201, 'FOOD BOOTH', nan],\n",
       " 'CHURCH/SPECIAL EVENTS': [202, 'SPECIAL EVENT', nan],\n",
       " 'BEVERAGE/SILVERWARE WAREHOUSE': [203, 'BEVERAGE', 'WAREHOUSE'],\n",
       " 'BAKERY/RESTAURANT': [204, 'BAKERY', 'RESTAURANT'],\n",
       " 'DRUG/FOOD STORE': [205, 'DRUG', 'FOOD BOOTH'],\n",
       " 'GYM': [206, 'GYM', nan],\n",
       " 'MOBILPREPARED FOOD VENDOR': [207, 'MOBILE FOOD', nan],\n",
       " 'GROCERY STORE/TAQUERIA': [208, 'GROCERY', 'TAQUERIA'],\n",
       " 'SOUP KITCHEN': [209, 'KITCHEN', nan],\n",
       " 'PHARMACY/GROCERY': [210, 'GROCERY', 'PHARMACY'],\n",
       " 'ADULT DAYCARE': [211, 'DAYCARE', nan],\n",
       " 'WATERMELON HOUSE': [212, 'WATERMELON HOUSE', nan],\n",
       " 'DINING HALL': [213, 'BANQUET', nan],\n",
       " 'CAFE/STORE': [214, 'CAFETERIA', 'STORE'],\n",
       " 'SMOKEHOUSE': [215, 'SMOKEHOUSE', nan],\n",
       " 'PASTRY SCHOOL': [216, 'SCHOOL', nan],\n",
       " 'ICE CREAM': [217, 'ICE CREAM', nan],\n",
       " 'GROCERY(GAS STATION)': [218, 'GAS', 'GROCERY'],\n",
       " 'PRODUCE VENDOR': [219, 'PRODUCE', nan],\n",
       " 'LOUNGE': [220, 'LOUNGE', nan],\n",
       " 'RESTAURANT/GROCERY': [221, 'GROCERY', 'RESTAURANT'],\n",
       " 'WINE TASTING BAR': [222, 'BAR', nan],\n",
       " 'GAS STATION/FOOD': [223, 'GAS', 'FOOD BOOTH'],\n",
       " 'GROCERY': [224, 'GROCERY', nan],\n",
       " 'EVENT VENU': [225, 'EVENT VENU', nan],\n",
       " 'PHARMACY': [226, 'PHARMACY', nan],\n",
       " 'BAKERY/ RESTAURANT': [227, 'BAKERY', 'RESTAURANT'],\n",
       " 'PANTRY': [228, 'PANTRY', nan],\n",
       " 'HERBAL LIFE': [229, 'HERBALIFE', nan],\n",
       " 'DONUT SHOP': [230, 'BAKERY', nan],\n",
       " 'CATERING/CAFE': [231, 'CAFETERIA', 'CATERING'],\n",
       " 'TEACHING SCHOOL': [232, 'SCHOOL', nan],\n",
       " 'HEALTH CARE STORE': [233, 'HEALTH', nan],\n",
       " 'YOUTH HOUSING': [234, 'HOUSING', nan],\n",
       " 'SUMMER FEEDING PREP AREA': [235, 'SUMMER FEEDING', nan],\n",
       " 'NAIL SHOP': [236, 'NAIL SHOP', nan],\n",
       " 'REST/ROOFTOP': [237, 'RESTAURANT', 'ROOFTOP'],\n",
       " 'SMOOTHIE BAR': [238, 'BAR', nan],\n",
       " 'GAS STATION/GROCERY': [239, 'GAS', 'GROCERY'],\n",
       " 'URBAN FARM': [240, 'FARM', nan],\n",
       " 'COFFEE KIOSK': [241, 'KIOSK', nan],\n",
       " 'CHURCH/DAY CARE': [242, 'DAYCARE', nan],\n",
       " 'SUPPORTIVE LIVING FACILITY': [243, 'SUPPORTIVE LIVING', nan],\n",
       " 'GROCERY/DELI': [244, 'DELI', 'GROCERY'],\n",
       " 'COFFEE/TEA': [245, 'COFFEE', nan],\n",
       " 'SERVICE BAR/THEATRE': [246, 'BAR', 'THEATER'],\n",
       " 'BANQUETS': [247, 'BANQUET', nan],\n",
       " 'HERABALIFE': [248, 'HERBALIFE', nan],\n",
       " 'TOBACCO STORE': [249, 'TOBACCO', nan],\n",
       " 'SNACK SHOP': [250, 'SNACK', nan],\n",
       " 'BANQUET ROOM': [251, 'BANQUET', nan],\n",
       " 'WHOLESALE BAKERY': [252, 'BAKERY', nan],\n",
       " 'GOLF COURSE CONNCESSION STAND': [253, 'GOLF', nan],\n",
       " 'BREWERY': [254, 'BREWERY', nan],\n",
       " 'GROCERY/BUTCHER': [255, 'BUTCHER', 'GROCERY'],\n",
       " 'TAVERN/RESTAURANT': [256, 'RESTAURANT', 'TAVERN'],\n",
       " 'GROCERY STORE/ RESTAURANT': [257, 'GROCERY', 'RESTAURANT'],\n",
       " 'TENT RSTAURANT': [258, 'RESTAURANT', nan],\n",
       " 'NEWSSTAND': [259, 'NEWSTAND', nan],\n",
       " 'GROCERY/BAKERY': [260, 'BAKERY', 'GROCERY'],\n",
       " 'VIDEO STORE': [261, 'VIDEO STORE', nan],\n",
       " 'BOWLING LANES/BANQUETS': [262, 'BOWLING LANES', 'BANQUETS'],\n",
       " 'FISH MARKET': [263, 'FISH MARKET', nan],\n",
       " 'POOL': [264, 'POOL', nan],\n",
       " 'TEMPORARY KIOSK': [265, 'KIOSK', nan],\n",
       " 'CULINARY CLASS ROOMS': [266, 'SCHOOL', nan],\n",
       " 'THEATRE': [267, 'THEATER', nan],\n",
       " 'CAFE': [268, 'CAFETERIA', nan],\n",
       " 'HEALTH CENTER': [269, 'HEALTH', nan],\n",
       " '(GAS STATION)': [270, 'GAS', nan],\n",
       " 'RETAIL': [271, 'RETAIL', nan],\n",
       " 'PACKAGED LIQUOR': [272, 'LIQUOR', nan],\n",
       " 'MOBILE FROZEN DESSERTS DISPENSER-NON-MOTORIZED': [273, 'MOBILE FOOD', nan],\n",
       " 'RETAIL FOOD/GAS STATION': [274, 'GAS', 'RETAIL'],\n",
       " 'CLOTHING STORE': [275, 'CLOTHING', nan],\n",
       " 'GELATO SHOP': [276, 'GELATO', nan],\n",
       " 'CHILDERN ACTIVITY FACILITY': [277, \"CHILDREN'S SERVICES FACILITY\", nan],\n",
       " 'CHARTER SCHOOL CAFETERIA': [278, 'CHARTER SCHOOL', nan],\n",
       " 'SLAUGHTER HOUSE/ GROCERY': [279, 'GROCERY', 'POULTRY'],\n",
       " 'HERBALCAL': [280, 'HERBALIFE', nan],\n",
       " 'GAS STATION/CONVENIENCE STORE': [281, 'GAS', 'CONVENIENCE'],\n",
       " 'MOBIL FOOD 1315': [282, 'MOBILE FOOD', nan],\n",
       " 'AFTER SCHOOL PROGRAM': [283, 'SCHOOL', nan],\n",
       " 'PUSH CARTS': [284, 'PUSH CART', nan],\n",
       " 'DISTRIBUTION CENTER': [285, 'DISTRIBUTION CENTER', nan],\n",
       " 'HERBAL DRINKS': [286, 'HERBALIFE', nan],\n",
       " '15 MONTS TO 5 YEARS OLD': [287, 'DAYCARE', nan],\n",
       " 'HIGH SCHOOL KITCHEN': [288, 'KITCHEN', nan],\n",
       " 'CANDY SHOP': [289, 'CANDY', nan],\n",
       " 'REPACKAGING PLANT': [290, 'REPACKAGING PLANT', nan],\n",
       " 'GAS STATION STORE': [291, 'GAS', nan],\n",
       " 'GAS STATION/ GROCERY STORE': [292, 'GAS', 'GROCERY'],\n",
       " 'JUICE BAR': [293, 'JUICE', nan],\n",
       " 'GAS STATION /SUBWAY MINI MART.': [294, 'GAS', 'MINI MART'],\n",
       " 'COFFEE VENDING MACHINE': [295, 'KIOSK', nan],\n",
       " 'MEXICAN CANDY STORE': [296, 'CANDY', nan],\n",
       " 'GROCERY STORE /PHARMACY': [297, 'GROCERY', 'PHARMACY'],\n",
       " 'BAKERY/GROCERY': [298, 'BAKERY', 'GROCERY'],\n",
       " 'CONVNIENCE STORE': [299, 'CONVENIENCE', nan],\n",
       " 'CHURCH/SPECIAL EVENT': [300, 'SPECIAL EVENT', nan],\n",
       " 'DRUG TREATMENT FACILITY': [301, 'DRUG', nan],\n",
       " 'CATERED EVENTS': [302, 'CATERING', nan],\n",
       " 'HERBAL': [303, 'HERBALIFE', nan],\n",
       " 'COMMISARY RESTAURANT': [304, 'COMMISSARY', nan],\n",
       " 'DISTRIBUTOR': [305, 'DISTRIBUTION CENTER', nan],\n",
       " 'NUTRITION STORE': [306, 'NUTRITION', nan],\n",
       " 'REHAB CENTER': [307, 'REHAB CENTER', nan],\n",
       " 'TEA STORE': [308, 'COFFEE', nan],\n",
       " 'VFW HALL': [309, 'VFW HALL', nan],\n",
       " 'FRENCH MARKET SPACE': [310, 'MARKET', nan],\n",
       " 'MOBILE FROZEN DESSERT DISP/NON-MOTORIZED': [311, 'MOBILE FOOD', nan],\n",
       " 'GROCERY/DOLLAR STORE': [312, 'DOLLAR', 'GROCERY'],\n",
       " 'GROCERY/TAQUERIA': [313, 'GROCERY', 'TAQUERIA'],\n",
       " 'FROZEN DESSERT PUSHCARTS': [314, 'PUSH CART', nan],\n",
       " 'EXERCISE AND NUTRITION BAR': [315, 'NUTRITION', nan],\n",
       " 'DAY CARE': [316, 'DAYCARE', nan],\n",
       " 'DRUG STORE/GROCERY': [317, 'DRUG', 'GROCERY'],\n",
       " 'MOBILE FROZEN DESSERT DISPENSER_NON  MOTORIZED.': [318, 'MOBILE FOOD', nan],\n",
       " 'CUSTOM POULTRY SLAUGHTER': [319, 'POULTRY', nan],\n",
       " 'GAS STATION/STORE GROCERY': [320, 'GAS', 'GROCERY'],\n",
       " 'POP-UP FOOD ESTABLISHMENT USER-TIER III': [321,\n",
       "  'POP-UP FOOD ESTABLISHMENT USER-TIER III',\n",
       "  nan],\n",
       " 'WHOLESALE & RETAIL': [322, 'RETAIL', 'WHOLESALE'],\n",
       " 'CONVENIENCE/GAS STATION': [323, 'CONVENIENCE', 'GAS'],\n",
       " 'HERBALIFE STORE': [324, 'HERBALIFE', nan],\n",
       " \"1023 CHILDREN'S SERVICES FACILITY\": [325,\n",
       "  \"CHILDREN'S SERVICES FACILITY\",\n",
       "  nan],\n",
       " 'RETAIL WINE/WINE BAR': [326, 'BAR', nan],\n",
       " 'GROCERY STORE / GAS STATION': [327, 'GAS', 'GROCERY'],\n",
       " 'DAYCARE 6 WKS-5YRS': [328, 'DAYCARE', nan],\n",
       " 'CAT/LIQUOR': [329, 'LIQUOR', nan],\n",
       " 'HERBAL LIFE SHOP': [330, 'HERBALIFE', nan],\n",
       " 'CANDY': [331, 'CANDY', nan],\n",
       " 'COLD/FROZEN FOOD STORAGE': [332, 'FOOD ESTABLISHMENT', nan],\n",
       " 'NIGHT CLUB': [333, 'CLUB', nan],\n",
       " 'GROCERY/DRUG STORE': [334, 'DRUG', 'GROCERY'],\n",
       " 'LIQUOR STORE': [335, 'LIQUOR', nan],\n",
       " 'HERBAL REMEDY': [336, 'HERBALIFE', nan],\n",
       " 'VENDING COMMISSARY': [337, 'COMMISSARY', nan],\n",
       " 'CAR WASH': [338, 'CAR WASH', nan],\n",
       " 'COFFEE ROASTER': [339, 'COFFEE', nan],\n",
       " 'KITCHEN DEMO': [340, 'KITCHEN', nan],\n",
       " 'CATERED LIQUOR': [341, 'LIQUOR', nan],\n",
       " 'CHURCH/AFTER SCHOOL PROGRAM': [342, 'SCHOOL', nan],\n",
       " 'LONG-TERM CARE': [343, 'LONG TERM CARE ', nan],\n",
       " 'ASSISSTED LIVING': [344, 'ASSISTEDLIVING', nan],\n",
       " 'LIVE BUTCHER': [345, 'LIVE BUTCHER', nan],\n",
       " 'RESTAURANT AND LIQUOR': [346, 'LIQUOR', 'RESTAURANT'],\n",
       " 'CATERING AND WHOLESALE': [347, 'CATERING', 'WHOLESALE'],\n",
       " 'ROOFTOP PATIO': [348, 'ROOFTOP', nan],\n",
       " 'DRUG/GROCERY STORE': [349, 'DRUG', 'GROCERY'],\n",
       " 'DAY SPA': [350, 'DAY SPA', nan],\n",
       " 'HELICOPTER TERMINAL': [351, 'HELICOPTER TERMINAL', nan],\n",
       " 'PALETERIA /ICECREAM SHOP': [352, 'ICE CREAM', 'PALETERIA'],\n",
       " 'FITNESS STUDIO': [353, 'GYM', nan],\n",
       " 'DOLLAR & GROCERY STORE': [354, 'DOLLAR', 'GROCERY'],\n",
       " 'DAY CARE COMBO (1586)': [355, 'DAYCARE', nan],\n",
       " 'BANQUETS/ROOM SERVICE': [356, 'BANQUET', 'ROOM SERVICE'],\n",
       " '1584-DAY CARE ABOVE 2 YEARS': [357, 'DAYCARE', nan],\n",
       " 'FOOD PANTRY': [358, 'PANTRY', nan],\n",
       " 'BOYS AND GIRLS CLUB': [359, 'CLUB', nan],\n",
       " 'DELI': [360, 'DELI', nan],\n",
       " 'COMMIASARY': [361, 'COMMISSARY', nan],\n",
       " 'TAVERN-LIQUOR': [362, 'TAVERN', 'LIQUOR'],\n",
       " 'ANIMAL SHELTER CAFE PERMIT': [363, 'ANIMAL SHELTER', nan],\n",
       " 'DAYCARE 1586': [364, 'DAYCARE', nan],\n",
       " 'NON -PROFIT': [365, 'NGO', nan],\n",
       " 'LIQUOR/COFFEE KIOSK': [366, 'KIOSK', nan],\n",
       " 'FROZEN DESSERTS DISPENSER-NON-MOTORIZED': [367, 'MOBILE FOOD', nan],\n",
       " 'MUSEUM/GALLERY': [368, 'ART GALLERY', 'MUSEUM'],\n",
       " 'MOBILE FOOD DESSERTS VENDOR': [369, 'MOBILE FOOD', nan],\n",
       " 'TAVERN/STORE': [370, 'TAVERN', 'STORE'],\n",
       " 'CANDY MAKER': [371, 'CANDY', nan],\n",
       " 'UNUSED STORAGE': [372, 'UNUSED STORAGE', nan],\n",
       " 'ADULT FAMILY CARE CENTER': [373, 'DAYCARE', nan],\n",
       " 'MOBILE DESSERT CART': [374, 'MOBILE FOOD', nan],\n",
       " 'LAUNDROMAT': [375, 'LAUNDROMAT', nan],\n",
       " 'POP-UP FOOD ESTABLISHMENT USER-TIER II': [376,\n",
       "  'POP-UP FOOD ESTABLISHMENT USER-TIER II',\n",
       "  nan],\n",
       " 'ART GALLERY': [377, 'ART GALLERY', nan],\n",
       " 'PACKAGED FOOD DISTRIBUTION': [378, 'PACKAGE', nan],\n",
       " 'RELIGIOUS': [379, 'RELIGIOUS', nan],\n",
       " 'NON-FOR PROFIT BASEMENT KIT': [380, 'NGO', nan],\n",
       " 'FURNITURE STORE': [381, 'FURNITURE', nan],\n",
       " 'FROZEN DESSERTS DISPENSER -NON MOTORIZED': [382, 'MOBILE FOOD', nan],\n",
       " 'PRODUCE STAND': [383, 'PRODUCE STAND', nan],\n",
       " 'CONVENIENCE/DRUG STORE': [384, 'CONVENIENCE', 'DRUG'],\n",
       " 'DELI/GROCERY STORE': [385, 'DELI', 'GROCERY'],\n",
       " 'DRUG STORE/W/ FOOD': [386, 'DRUG', 'FOOD'],\n",
       " 'DELI/BAKERY': [387, 'DELI', 'BAKERY'],\n",
       " 'DOLLAR STORE SELLING GROCERY': [388, 'DOLLAR', nan],\n",
       " 'GENERAL STORE': [389, 'STORE', nan],\n",
       " '(CONVENIENCE STORE)': [390, 'CONVENIENCE', nan],\n",
       " 'RETAIL STORE': [391, 'RETAIL', nan],\n",
       " 'HERBALIFE/ZUMBA': [392, 'HERBALIFE', nan],\n",
       " 'RETAIL STORE OFFERS COOKING CLASSES': [393, 'RETAIL', nan],\n",
       " 'ASSISTED LIVING FACILITY': [394, 'ASSISTEDLIVING', nan],\n",
       " 'RESTAURANT/LIQUOR': [395, 'LIQUOR', 'RESTAURANT'],\n",
       " 'POPCORN CORN': [396, 'POPCORN', nan],\n",
       " 'HERBALIFE NUTRITION': [397, 'HERBALIFE', nan],\n",
       " 'BLOCKBUSTER VIDEO': [398, 'BLOCK BUSTER VIDEO', nan],\n",
       " 'TAP ROOM/TAVERN/LIQUOR STORE': [399, 'LIQUOR', 'TAVERN'],\n",
       " 'MASSAGE BAR': [400, 'BAR', nan],\n",
       " 'INCUBATOR': [401, 'INCUBATOR', nan],\n",
       " 'JUICE BAR/GROCERY': [402, 'JUICE', 'GROCERY'],\n",
       " 'HAIR SALON': [403, 'HAIR', nan],\n",
       " 'COFFEE': [404, 'COFFEE', nan],\n",
       " 'GROCERY STORE/DELI': [405, 'DELI', 'GROCERY'],\n",
       " 'THEATER/BAR': [406, 'BAR', 'THEATER'],\n",
       " 'PEDDLER': [407, 'PEDDLER', nan],\n",
       " 'PACKAGED HEALTH FOODS': [408, 'PACKAGE', nan],\n",
       " 'AFTER SCHOOL CARE': [409, 'DAYCARE', nan],\n",
       " 'MOBILE FROZEN DESSERTS DISPENSER-NON- MOTORIZED': [410, 'MOBILE FOOD', nan],\n",
       " 'TAVERN/1006': [411, 'TAVERN', nan],\n",
       " 'ILLEGAL VENDOR': [412, 'ILLEGAL', nan],\n",
       " 'GIFT SHOP': [413, 'GIFT', nan],\n",
       " 'VENDING MACHINE': [414, 'KIOSK', nan],\n",
       " 'PREPACKAGE MEAL DISTRIBUTOR (1006 RETAIL)': [415, 'RETAIL', nan],\n",
       " 'RESTAURANT/BAR/THEATER': [416, 'BAR', 'RESTAURANT'],\n",
       " 'GROCERY/LIQUOR': [417, 'LIQUOR', 'GROCERY'],\n",
       " 'TAVERN/BAR': [418, 'BAR', 'TAVERN'],\n",
       " 'NP-KIOSK': [419, 'KIOSK', nan],\n",
       " 'GIFT/CARD SHOP WITH CANDY': [420, 'GIFT', 'CANDY'],\n",
       " 'GROCERY/LIQUOR STORE': [421, 'LIQUOR', 'GROCERY'],\n",
       " 'MOBILE FROZEN DESSERTS DISPENSER-NON-MOTOR': [422, 'MOBILE FOOD', nan],\n",
       " 'PROTEIN SHAKE BAR': [423, 'BAR', nan],\n",
       " 'SHAKES/TEAS': [424, 'COFFEE', nan],\n",
       " 'MAIN KITCHEN': [425, 'KITCHEN', nan],\n",
       " 'MEAT MARKET': [426, 'MEAT PACKING', nan],\n",
       " 'TAVERN/LIQUOR': [427, 'TAVERN', 'LIQUOR'],\n",
       " 'HEALTH CENTER/NUTRITION CLASSES': [428, 'HEALTH', nan],\n",
       " 'HERBAL STORE': [429, 'HERBALIFE', nan],\n",
       " 'SERVICE GAS STATION': [430, 'GAS', nan],\n",
       " 'DOLLAR STORE WITH GROCERY': [431, 'DOLLAR', nan],\n",
       " 'PREPACAKAGED FOODS': [432, 'PACKAGE', nan],\n",
       " 'INTERNET CAFE': [433, 'COFFEE', nan],\n",
       " 'MOBILE DESSERT VENDOR': [434, 'MOBILE FOOD', nan],\n",
       " 'SPA': [435, 'SPA', nan]}"
      ]
     },
     "execution_count": 12,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "final_map_index\n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 13,
   "metadata": {},
   "outputs": [
    {
     "name": "stderr",
     "output_type": "stream",
     "text": [
      "/opt/anaconda3/lib/python3.7/site-packages/ipykernel_launcher.py:10: SettingWithCopyWarning: \n",
      "A value is trying to be set on a copy of a slice from a DataFrame\n",
      "\n",
      "See the caveats in the documentation: http://pandas.pydata.org/pandas-docs/stable/user_guide/indexing.html#returning-a-view-versus-a-copy\n",
      "  # Remove the CWD from sys.path while we load stuff.\n"
     ]
    }
   ],
   "source": [
    "# Fill Empty Data Types - Train\n",
    "data_type_null = data[data['Type'].isnull()]\n",
    "for ind in data_type_null.index:\n",
    "    \n",
    "    FacilityID = data_type_null['FacilityID'][ind]\n",
    "    data_license_df = data[data['FacilityID'] == FacilityID]\n",
    "    \n",
    "    if (len(data_license_df[data_license_df ['Type'].notnull()]  ) > 0 ):\n",
    "                 \n",
    "        data['Type'][ind] = data_license_df[data_license_df ['Type'].notnull()]['Type'].values[0]"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": []
  },
  {
   "cell_type": "code",
   "execution_count": 14,
   "metadata": {},
   "outputs": [
    {
     "name": "stderr",
     "output_type": "stream",
     "text": [
      "/opt/anaconda3/lib/python3.7/site-packages/ipykernel_launcher.py:12: SettingWithCopyWarning: \n",
      "A value is trying to be set on a copy of a slice from a DataFrame\n",
      "\n",
      "See the caveats in the documentation: http://pandas.pydata.org/pandas-docs/stable/user_guide/indexing.html#returning-a-view-versus-a-copy\n",
      "  if sys.path[0] == '':\n"
     ]
    }
   ],
   "source": [
    "# Fill Data Types - Test\n",
    "\n",
    "test_data_type_null = test_data[test_data['Type'].isnull()]\n",
    "\n",
    "for ind in test_data_type_null.index:\n",
    "    \n",
    "    FacilityID = test_data_type_null['FacilityID'][ind]\n",
    "    test_data_license_df = test_data[test_data['FacilityID'] == FacilityID]\n",
    "    \n",
    "    if (len(test_data_license_df[test_data_license_df ['Type'].notnull()]  ) > 0 ):\n",
    "                 \n",
    "        test_data['Type'][ind] = test_data_license_df[test_data_license_df ['Type'].notnull()]['Type'].values[0]\n",
    "    \n",
    "    \n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": []
  },
  {
   "cell_type": "code",
   "execution_count": 15,
   "metadata": {},
   "outputs": [],
   "source": [
    "def map_final_type(x):\n",
    "    \n",
    "    return [ final_map_index[x][1], final_map_index[x][2] ]"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 16,
   "metadata": {},
   "outputs": [
    {
     "name": "stderr",
     "output_type": "stream",
     "text": [
      "/opt/anaconda3/lib/python3.7/site-packages/ipykernel_launcher.py:1: FutureWarning: Sorting because non-concatenation axis is not aligned. A future version\n",
      "of pandas will change to not sort by default.\n",
      "\n",
      "To accept the future behavior, pass 'sort=False'.\n",
      "\n",
      "To retain the current behavior and silence the warning, pass 'sort=True'.\n",
      "\n",
      "  \"\"\"Entry point for launching an IPython kernel.\n"
     ]
    }
   ],
   "source": [
    "type_concat = pd.concat([data, test_data], axis = 0).reset_index(drop=True)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 17,
   "metadata": {},
   "outputs": [
    {
     "name": "stderr",
     "output_type": "stream",
     "text": [
      "/opt/anaconda3/lib/python3.7/site-packages/ipykernel_launcher.py:7: FutureWarning: Sorting because non-concatenation axis is not aligned. A future version\n",
      "of pandas will change to not sort by default.\n",
      "\n",
      "To accept the future behavior, pass 'sort=False'.\n",
      "\n",
      "To retain the current behavior and silence the warning, pass 'sort=True'.\n",
      "\n",
      "  import sys\n"
     ]
    }
   ],
   "source": [
    "merged_data = get_dummies(data, test_data, ['City','State','Reason','SectionViolations', \\\n",
    "                                            'LocationID','RiskLevel','month','year'])"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 18,
   "metadata": {},
   "outputs": [],
   "source": [
    "merged_data['unique_type_map'] = merged_data['Type'].apply(map_final_type)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": []
  },
  {
   "cell_type": "code",
   "execution_count": 19,
   "metadata": {},
   "outputs": [
    {
     "name": "stderr",
     "output_type": "stream",
     "text": [
      "/opt/anaconda3/lib/python3.7/site-packages/ipykernel_launcher.py:13: SettingWithCopyWarning: \n",
      "A value is trying to be set on a copy of a slice from a DataFrame\n",
      "\n",
      "See the caveats in the documentation: http://pandas.pydata.org/pandas-docs/stable/user_guide/indexing.html#returning-a-view-versus-a-copy\n",
      "  del sys.path[0]\n"
     ]
    }
   ],
   "source": [
    "# Calculating difference between previous inspection and current inspection\n",
    "merged_data['Date_m'] = merged_data['Date'].apply(convert_date)\n",
    "merged_data['prior_date'] = 0\n",
    "sorted_date = merged_data.sort_values(by = ['Date_m'])\n",
    "group_by = sorted_date.groupby('FacilityID')\n",
    "# data[data['FacilityID'] == 1].sort_values(by = 'Date_m')\n",
    "\n",
    "previous_index = 0\n",
    "for name, group in group_by:\n",
    "    for row_index, ind in enumerate(group.index):       \n",
    "\n",
    "        if(row_index != 0):\n",
    "            merged_data['prior_date'][ind] = (group['Date_m'][ind] - group['Date_m'][previous_index]).days\n",
    "            previous_index = ind\n",
    "\n",
    "        else:\n",
    "            previous_index = ind"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "\n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": []
  },
  {
   "cell_type": "code",
   "execution_count": 20,
   "metadata": {},
   "outputs": [
    {
     "name": "stderr",
     "output_type": "stream",
     "text": [
      "/opt/anaconda3/lib/python3.7/site-packages/ipykernel_launcher.py:14: SettingWithCopyWarning: \n",
      "A value is trying to be set on a copy of a slice from a DataFrame\n",
      "\n",
      "See the caveats in the documentation: http://pandas.pydata.org/pandas-docs/stable/user_guide/indexing.html#returning-a-view-versus-a-copy\n",
      "  \n",
      "/opt/anaconda3/lib/python3.7/site-packages/ipykernel_launcher.py:17: SettingWithCopyWarning: \n",
      "A value is trying to be set on a copy of a slice from a DataFrame\n",
      "\n",
      "See the caveats in the documentation: http://pandas.pydata.org/pandas-docs/stable/user_guide/indexing.html#returning-a-view-versus-a-copy\n"
     ]
    }
   ],
   "source": [
    "# To check whether this is the first inspection\n",
    "merged_data['Date_m'] = merged_data['Date'].apply(convert_date)\n",
    "merged_data['first_date'] = 0\n",
    "sorted_date = merged_data.sort_values(by = ['Date_m'])\n",
    "group_by = sorted_date.groupby('FacilityID')\n",
    "# data[data['FacilityID'] == 1].sort_values(by = 'Date_m')\n",
    "\n",
    "previous_index = 0\n",
    "for name, group in group_by:\n",
    "    for row_index, ind in enumerate(group.index):       \n",
    "\n",
    "        \n",
    "        if(row_index == 0):\n",
    "            merged_data['first_date'][ind] = 1\n",
    "\n",
    "        else:\n",
    "            merged_data['first_date'][ind] = 0"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": []
  },
  {
   "cell_type": "code",
   "execution_count": 21,
   "metadata": {},
   "outputs": [
    {
     "name": "stderr",
     "output_type": "stream",
     "text": [
      "/opt/anaconda3/lib/python3.7/site-packages/ipykernel_launcher.py:25: SettingWithCopyWarning: \n",
      "A value is trying to be set on a copy of a slice from a DataFrame\n",
      "\n",
      "See the caveats in the documentation: http://pandas.pydata.org/pandas-docs/stable/user_guide/indexing.html#returning-a-view-versus-a-copy\n",
      "/opt/anaconda3/lib/python3.7/site-packages/ipykernel_launcher.py:22: SettingWithCopyWarning: \n",
      "A value is trying to be set on a copy of a slice from a DataFrame\n",
      "\n",
      "See the caveats in the documentation: http://pandas.pydata.org/pandas-docs/stable/user_guide/indexing.html#returning-a-view-versus-a-copy\n",
      "/opt/anaconda3/lib/python3.7/site-packages/ipykernel_launcher.py:16: SettingWithCopyWarning: \n",
      "A value is trying to be set on a copy of a slice from a DataFrame\n",
      "\n",
      "See the caveats in the documentation: http://pandas.pydata.org/pandas-docs/stable/user_guide/indexing.html#returning-a-view-versus-a-copy\n",
      "  app.launch_new_instance()\n"
     ]
    }
   ],
   "source": [
    "# Check whether it is a last inspection and fill the empty types grouped by Facility ID\n",
    "merged_data['Date_m'] = merged_data['Date'].apply(convert_date)\n",
    "merged_data['is_last_date'] = 0\n",
    "sorted_date = merged_data.sort_values(by = ['Date_m'])\n",
    "group_by = sorted_date.groupby('FacilityID')\n",
    "# data[data['FacilityID'] == 1].sort_values(by = 'Date_m')\n",
    "\n",
    "previous_index = 0\n",
    "for name, group in group_by:\n",
    "    \n",
    "    typeVal = np.nan\n",
    "    for row_index, ind in enumerate(group.index):     \n",
    "\n",
    "        \n",
    "        if type(merged_data['Type'][ind]) == float and np.isnan(merged_data['Type'][ind]):            \n",
    "            merged_data['Type'][ind] = typeVal\n",
    "        else:\n",
    "            typeVal = merged_data['Type'][ind]\n",
    "            \n",
    "        \n",
    "        if(row_index == len(group.index) - 1):\n",
    "            merged_data['is_last_date'][ind] = 1\n",
    "\n",
    "        else:\n",
    "            merged_data['is_last_date'][ind] = 0"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 22,
   "metadata": {},
   "outputs": [
    {
     "name": "stderr",
     "output_type": "stream",
     "text": [
      "/opt/anaconda3/lib/python3.7/site-packages/ipykernel_launcher.py:16: SettingWithCopyWarning: \n",
      "A value is trying to be set on a copy of a slice from a DataFrame\n",
      "\n",
      "See the caveats in the documentation: http://pandas.pydata.org/pandas-docs/stable/user_guide/indexing.html#returning-a-view-versus-a-copy\n",
      "  app.launch_new_instance()\n",
      "/opt/anaconda3/lib/python3.7/site-packages/ipykernel_launcher.py:13: SettingWithCopyWarning: \n",
      "A value is trying to be set on a copy of a slice from a DataFrame\n",
      "\n",
      "See the caveats in the documentation: http://pandas.pydata.org/pandas-docs/stable/user_guide/indexing.html#returning-a-view-versus-a-copy\n",
      "  del sys.path[0]\n"
     ]
    }
   ],
   "source": [
    "# Checking last inspection grouped by License No\n",
    "merged_data['Date_m'] = merged_data['Date'].apply(convert_date)\n",
    "merged_data['is_last_date_license'] = 0\n",
    "sorted_date = merged_data.sort_values(by = ['Date_m'])\n",
    "group_by = sorted_date.groupby('LicenseNo')\n",
    "# data[data['FacilityID'] == 1].sort_values(by = 'Date_m')\n",
    "\n",
    "previous_index = 0\n",
    "for name, group in group_by:\n",
    "    for row_index, ind in enumerate(group.index):     \n",
    "       \n",
    "        if(row_index == (len(group.index) - 1)):\n",
    "            merged_data['is_last_date_license'][ind] = 1\n",
    "\n",
    "        else:\n",
    "            merged_data['is_last_date_license'][ind] = 0\n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 23,
   "metadata": {},
   "outputs": [
    {
     "name": "stderr",
     "output_type": "stream",
     "text": [
      "/opt/anaconda3/lib/python3.7/site-packages/ipykernel_launcher.py:16: SettingWithCopyWarning: \n",
      "A value is trying to be set on a copy of a slice from a DataFrame\n",
      "\n",
      "See the caveats in the documentation: http://pandas.pydata.org/pandas-docs/stable/user_guide/indexing.html#returning-a-view-versus-a-copy\n",
      "  app.launch_new_instance()\n",
      "/opt/anaconda3/lib/python3.7/site-packages/ipykernel_launcher.py:13: SettingWithCopyWarning: \n",
      "A value is trying to be set on a copy of a slice from a DataFrame\n",
      "\n",
      "See the caveats in the documentation: http://pandas.pydata.org/pandas-docs/stable/user_guide/indexing.html#returning-a-view-versus-a-copy\n",
      "  del sys.path[0]\n"
     ]
    }
   ],
   "source": [
    "# Checking last inspection grouped by Geo Location\n",
    "merged_data['Date_m'] = merged_data['Date'].apply(convert_date)\n",
    "merged_data['is_last_date_geoloc'] = 0\n",
    "sorted_date = merged_data.sort_values(by = ['Date_m'])\n",
    "group_by = sorted_date.groupby('Geo_Loc')\n",
    "# data[data['FacilityID'] == 1].sort_values(by = 'Date_m')\n",
    "\n",
    "previous_index = 0\n",
    "for name, group in group_by:\n",
    "    for row_index, ind in enumerate(group.index):     \n",
    "        \n",
    "        if(row_index == (len(group.index) - 1)):\n",
    "            merged_data['is_last_date_geoloc'][ind] = 1\n",
    "\n",
    "        else:\n",
    "            merged_data['is_last_date_geoloc'][ind] = 0"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 24,
   "metadata": {},
   "outputs": [],
   "source": [
    "# Calculating unique Types\n",
    "merged_data['unique_type_map'] = merged_data['Type'].apply(map_final_type)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 25,
   "metadata": {},
   "outputs": [],
   "source": [
    "type_dummies = merged_data['unique_type_map'].apply(collections.Counter)\n",
    "type_dummies_p = pd.DataFrame.from_records(type_dummies)\n",
    "type_dummies_final = type_dummies_p.drop(type_dummies_p.columns[1] , axis =1 )\n",
    "type_dummies_final = type_dummies_final.fillna(0)\n",
    "final_processed_df = pd.concat([merged_data, type_dummies_final], axis = 1)\n",
    "# Drop the original column after taking one hot encoding\n",
    "final_processed_df = final_processed_df.drop('unique_type_map', axis = 1)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 26,
   "metadata": {},
   "outputs": [],
   "source": [
    "# Normalising prior date\n",
    "final_processed_df['prior_date'] = final_processed_df['prior_date']/366"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 27,
   "metadata": {},
   "outputs": [],
   "source": [
    "# Taking Bins for prior_date\n",
    "final_processed_df['prior_date'] = pd.cut(final_processed_df['prior_date'], [ -0.1, 0.0001, 0.001, 0.09,  0.2, 0.3 ,0.4,0.5,0.6,0.7,0.8,0.9,1.1], include_lowest=False,labels=[0, 1, 2,3,4,5,6,7,8,9,10,11])\n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 28,
   "metadata": {},
   "outputs": [],
   "source": [
    "# One hot vector for the prior_date\n",
    "final_processed_df = pd.concat([pd.get_dummies(final_processed_df['prior_date'] , \\\n",
    "                                               prefix='prior_date', dummy_na=True) , final_processed_df],axis = 1)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 29,
   "metadata": {},
   "outputs": [],
   "source": [
    "# Splitting train and test\n",
    "test_df =  final_processed_df[final_processed_df['train'] == 0]\n",
    "train_df = final_processed_df[final_processed_df['train'] == 1]\n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 30,
   "metadata": {},
   "outputs": [
    {
     "name": "stderr",
     "output_type": "stream",
     "text": [
      "Using TensorFlow backend.\n"
     ]
    },
    {
     "data": {
      "text/plain": [
       "389"
      ]
     },
     "execution_count": 30,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "train_X = train_df.drop(['ID', 'Date', 'LicenseNo', 'FacilityID', 'FacilityName', 'Type',\n",
    "       'Street', 'City', 'State', 'LocationID', 'Reason', 'SectionViolations',\n",
    "       'RiskLevel', 'Geo_Loc', 'Inspection_Results', 'train','month','year','Date_m', 'prior_date'], axis = 1)\n",
    "# Date_m, prior_date\n",
    "\n",
    "train_y = train_df['Inspection_Results']\n",
    "\n",
    "from keras.utils import to_categorical\n",
    "y_binary = to_categorical(train_y)\n",
    "\n",
    "len(train_X.columns)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": []
  },
  {
   "cell_type": "code",
   "execution_count": 31,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "WARNING:tensorflow:From /opt/anaconda3/lib/python3.7/site-packages/tensorflow_core/python/ops/resource_variable_ops.py:1630: calling BaseResourceVariable.__init__ (from tensorflow.python.ops.resource_variable_ops) with constraint is deprecated and will be removed in a future version.\n",
      "Instructions for updating:\n",
      "If using Keras pass *_constraint arguments to layers.\n",
      "WARNING:tensorflow:From /opt/anaconda3/lib/python3.7/site-packages/keras/backend/tensorflow_backend.py:422: The name tf.global_variables is deprecated. Please use tf.compat.v1.global_variables instead.\n",
      "\n",
      "Epoch 1/10\n",
      "147443/147443 [==============================] - 21s 141us/step - loss: 0.3447 - accuracy: 0.8727\n",
      "Epoch 2/10\n",
      "147443/147443 [==============================] - 20s 138us/step - loss: 0.2975 - accuracy: 0.8844\n",
      "Epoch 3/10\n",
      "147443/147443 [==============================] - 20s 134us/step - loss: 0.2785 - accuracy: 0.8904s - loss: 0.2783 \n",
      "Epoch 4/10\n",
      "147443/147443 [==============================] - 19s 127us/step - loss: 0.2674 - accuracy: 0.8928\n",
      "Epoch 5/10\n",
      "147443/147443 [==============================] - 19s 131us/step - loss: 0.2594 - accuracy: 0.8965s - loss:\n",
      "Epoch 6/10\n",
      "147443/147443 [==============================] - 18s 125us/step - loss: 0.2533 - accuracy: 0.8984\n",
      "Epoch 7/10\n",
      "147443/147443 [==============================] - 19s 131us/step - loss: 0.2480 - accuracy: 0.9000\n",
      "Epoch 8/10\n",
      "147443/147443 [==============================] - 19s 130us/step - loss: 0.2433 - accuracy: 0.9026\n",
      "Epoch 9/10\n",
      "147443/147443 [==============================] - 19s 128us/step - loss: 0.2387 - accuracy: 0.9042\n",
      "Epoch 10/10\n",
      "147443/147443 [==============================] - 18s 119us/step - loss: 0.2351 - accuracy: 0.9057\n"
     ]
    }
   ],
   "source": [
    "from numpy.random import seed\n",
    "seed(6)\n",
    "\n",
    "import tensorflow as tf\n",
    "from numpy import loadtxt\n",
    "from keras.models import Sequential\n",
    "from keras.layers import Dense, Dropout\n",
    "from keras.optimizers import SGD\n",
    "\n",
    "opt = SGD(lr=0.01, momentum=0.9)\n",
    "\n",
    "model = Sequential()\n",
    "model.add(Dense(100, input_dim=389, activation='tanh'))\n",
    "\n",
    "# model.add(Dense(8, activation='tanh'))\n",
    "# model.add(Dense(20, activation='tanh'))\n",
    "# model.add(Dense(8, activation='relu'))\n",
    "model.add(Dense(7, activation='softmax'))\n",
    "\n",
    "\n",
    "model.compile(loss = \"categorical_crossentropy\" , optimizer='adam',metrics=['accuracy'] )\n",
    "history = model.fit(train_X, y_binary, epochs=10, batch_size=10)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 34,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "[<matplotlib.lines.Line2D at 0x129a3bcd0>]"
      ]
     },
     "execution_count": 34,
     "metadata": {},
     "output_type": "execute_result"
    },
    {
     "data": {
      "image/png": "iVBORw0KGgoAAAANSUhEUgAAAXoAAAD4CAYAAADiry33AAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAALEgAACxIB0t1+/AAAADh0RVh0U29mdHdhcmUAbWF0cGxvdGxpYiB2ZXJzaW9uMy4xLjEsIGh0dHA6Ly9tYXRwbG90bGliLm9yZy8QZhcZAAAgAElEQVR4nO3deXiV9Z338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Luir6rzKz6eJfqTDZ6L46m9+Noej/ek+jvhYZuREQSnIpeRCTBJWLR3x90gDii9+Joej+OpvfjPQn9XiTcGL2IiBwtEY/oRUSkAxW9iCH3u4gAAAJ5SURBVEiCS5iiN7OpZrbCzFab2TeDzhMkMysxs5fNbLmZ1ZrZV4POFDQzC5vZEjP7Y9BZgmZmfc3sCTN7J/pvZGLQmYJkZn8b/TmpMbPHzCwj6EzdLSGK3szCwH3ANKAcmGFm5cGmClQrcIe7nwNMAL6c5O8HwFeB5UGHiBP3AHPcfTRwPkn8vphZEfAVoNLdK4AwMD3YVN0vIYoeqAJWu3udu7cAs4BrAs4UGHff7O6Lo1/vIfKDXBRsquCYWTHwYeCBoLMEzcyygUuBnwO4e4u77wo2VeBSgF5mlgJkAg0B5+l2iVL0RcDGDo/rSeJi68jMyoCxwPxgkwTqbuD/Au1BB4kDQ4FG4KHoUNYDZpYVdKiguPsm4IfABmAzsNvd/xRsqu6XKEVvnSxL+vNGzaw38Dvga+7eHHSeIJjZR4Bt7r4o6CxxIgW4EPgvdx8L7AOSdk7LzPoR+et/CDAIyDKzG4JN1f0SpejrgY63UC8mAf/8OhVmlkqk5B9x9yeDzhOgi4GrzWwdkSG9y83s18FGClQ9UO/uh//Ce4JI8SerK4G17t7o7oeAJ4FJAWfqdolS9AuBEWY2xMzSiEymPB1wpsCYmREZg13u7j8OOk+Q3P1b7l7s7mVE/l285O4Jd8QWK3ffAmw0s1HRRVcAywKMFLQNwAQzy4z+3FxBAk5OpwQdoDu4e6uZzQSeIzJr/qC71wYcK0gXA58B3jazpdFlf+/uzwaYSeLH3wCPRA+K6oDPBpwnMO4+38yeABYTOVttCQl4OQRdAkFEJMElytCNiIgch4peRCTBqehFRBKcil5EJMGp6EVEEpyKXkQkwanoRUQS3P8H57qvTAbVDUUAAAAASUVORK5CYII=\n",
      "text/plain": [
       "<Figure size 432x288 with 1 Axes>"
      ]
     },
     "metadata": {
      "needs_background": "light"
     },
     "output_type": "display_data"
    }
   ],
   "source": [
    "import matplotlib.pyplot as plt\n",
    "plt.plot(history.history['loss'])"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 35,
   "metadata": {},
   "outputs": [],
   "source": [
    "test_X = test_df.drop(['ID', 'Date', 'LicenseNo', 'FacilityID', 'FacilityName', 'Type',\n",
    "       'Street', 'City', 'State', 'LocationID', 'Reason', 'SectionViolations',\n",
    "       'RiskLevel', 'Geo_Loc', 'Inspection_Results', 'train','month','year','Date_m', 'prior_date'], axis = 1)\n",
    "\n",
    "\n",
    "prediction = model.predict(test_X)\n",
    "\n",
    "sub_excel = pd.DataFrame(prediction, columns= ['FACILITY CHANGED','FAIL','FURTHER INSPECTION REQUIRED',\\\n",
    "                                               'INSPECTION OVERRULED','PASS','PASS(CONDITIONAL)','SHUT-DOWN'])\n",
    "\n",
    "\n",
    "sub_excel.to_excel(\"f14.xlsx\", index=False)\n",
    "\n",
    "save_model(\"best_final.sav\")"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": []
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "##### I tried - Algorithms like Random Forest Classifier, SVC Classifier, Isolation forest to remove outliers, SMOTE to balance the dataset, ExtraTreesClassifier and several other preprocessing steps\n",
    "I used Early stopping to avoid overfitting\n"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": []
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": []
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": []
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.7.4"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 2
}
